package Aptech.Service;

import java.util.Iterator;
import java.util.List;

import Aptech.DAL.MgCustommer;
import Aptech.DALInterface.CustommerInterface;
import HibernateMappingPoJo.Builts;
import HibernateMappingPoJo.Custommers;

public class SV_Custommers {
	CustommerInterface mgCus ;
	public SV_Custommers(){
		mgCus = new MgCustommer();
	}
	
	public  Custommers[] getAllCustomer(){
	       List<Custommers>  list = mgCus.getAllCustomer();

	       Custommers[] listCus = new Custommers[list.size()];
	        if (list != null) {
	            Iterator<Custommers> iter = list.iterator();
	            int i = 0;
	            while (iter.hasNext()) {
	            	Custommers tptd = (Custommers) iter.next();
	                listCus[i] = tptd;
	                i++;
	            }
	        }
	        return listCus;
	    }

	public void addCustommer(Custommers cus){
		mgCus.addCustommer(cus);
	}
	
	public void deleteCustommer(String id) {
		mgCus.deleteCustommer(id);
	}

	public void editCustommer(Custommers cus){
		mgCus.editCustommer(cus);
	}
	
	public Custommers getCustommerByID(String id){
		return mgCus.getCustommerByID(id);
	}
}
